<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 老猫 <zxxjjforever@163.com>
// +----------------------------------------------------------------------

namespace think;

// [ 入口文件 ]

$OSARRAY = ['Chrome','Windows_NT'];
$OSNT = $_SERVER['OS'];
//$OSagent = $_SERVER['HTTP_USER_AGENT'];
$OSAGENT = userBrowser();

//exit(json_encode($OSAGENT));
//exit(json_encode(in_array($OSNT ,$OSARRAY)));
//exit(json_encode(in_array($OSAGENT ,$OSARRAY)));

if (!in_array($OSNT ,$OSARRAY) || !in_array($OSAGENT ,$OSARRAY)){
    header("Location: http://www.110.com");
    exit;
}

// 调试模式开关
define('APP_DEBUG', true);
//应用Trace 开关
define('APP_TRACE', false);

// 定义CMF根目录,可更改此目录
define('CMF_ROOT', dirname(__DIR__) . '/');

// 定义CMF数据目录,可更改此目录
define('CMF_DATA', CMF_ROOT . 'data/');

// 定义应用目录
define('APP_PATH', CMF_ROOT . 'app/');
// 定义缓存目录
define('RUNTIME_PATH', CMF_ROOT . 'data/runtime/');

// 定义网站入口目录
define('WEB_ROOT', __DIR__ . '/');

// 加载基础文件
require CMF_ROOT . 'vendor/thinkphp/base.php';

// 执行应用并响应
Container::get('app', [APP_PATH])->run()->send();
function userBrowser() {
    $user_OSagent = $_SERVER['HTTP_USER_AGENT'];
    if (strpos($user_OSagent, "Maxthon") && strpos($user_OSagent, "MSIE")) {
        $visitor_browser = "Maxthon(Microsoft IE)";
    } elseif (strpos($user_OSagent, "NetCaptor")) {
        $visitor_browser = "NetCaptor";
    } elseif (strpos($user_OSagent, "Netscape")) {
        $visitor_browser = "Netscape";
    } elseif (strpos($user_OSagent, "Chrome")) {
        $visitor_browser = "Chrome";
    } elseif (strpos($user_OSagent, "Mozilla/5.0")) {
        $visitor_browser = "Mozilla";
    } else {
        $visitor_browser = "";
    }
    return $visitor_browser;
}